package org.firebug.spring.boot.event;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * 1.context.listener.classes=org.firebug.spring.boot.event.MyApplicationListener
 * 2.@Component org.firebug.spring.boot.event.MyApplicationListener implements ApplicationListener
 * 3.@EventListener
 */
@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(Application.class, args);
        context.publishEvent(context.getBean(MyApplicationEvent.class));
        context.close();
    }
}
